/*============================================================================*/
/*                   SMART CAR RACE - UDG LIONS                               */
/*============================================================================*/
/*                        OBJECT SPECIFICATION                                */
/*============================================================================*
* name:            PIT.h
* version:         1.0
* created_by:      Michel David Robles Romero
* date_created:    July 23 2010
*=============================================================================*/
/* DESCRIPTION : Header file for basic handling of PIT chanels                */
/*============================================================================*/
/* FUNCTION COMMENT : Provides exported functions and symbols for basic       */
/* 					  handling of PIT chanels                                 */
/*                                                                            */
/*============================================================================*/
/*                               OBJECT HISTORY                               */
/*============================================================================*/
/*  REVISION |   DATE      |                               |      AUTHOR      */
/*----------------------------------------------------------------------------*/
/*  1.0      | 23/july/2010 |                               | Michel D. Robles*/
/* Initial version for the Smart Car Race 2010 contest using Freescale        */
/* Bolero micro.                                                              */
/*============================================================================*/
#ifndef EXT_INT_H                                    /* To avoid double inclusion */
#define EXT_INT_H

/* Includes */
/* -------- */
#include "stdtypedef.h"

/* PIN PCR values definitions */


/* Exported types and constants */
/* ---------------------------- */

/* Types definition */

/* typedef */

/*==================================================*/ 
/* Declaration of exported constants                */
/*==================================================*/ 
/* BYTE constants */

/* WORD constants */

/* LONG and STRUCTURE constants */

/*======================================================*/ 
/* Definition of RAM variables                          */
/*======================================================*/ 
/* BYTE RAM variables */

/* WORD RAM variables */

/* LONG and STRUCTURE RAM variables */

/*======================================================*/ 
/* close variable declaration sections                  */
/*======================================================*/ 

/* Exported functions prototypes and macros */
/* ---------------------------------------- */


/* ========================================================================== *
 *                    EIRQn External Interrupt defines                        *
 * ========================================================================== */
 
//Para EXRQ[0]
#define EIRQ0_PCR  										(SIU.PCR[3].R = 0x0101) //PA3 Input Buffers : Enabled,	Weak Pull Up/Down Select : Up   
#define EIRQ0_enable									(SIU.IRER.B.EIRE0 = TRUE) //Habilita EIRQ[0] para interrupcion externa
#define EIRQ0_Rising_edge(rising)						(SIU.IREER.B.IREE0 = rising) //Rising-Edge Event Enable
#define EIRQ0_Failing_edge(failing)	 					(SIU.IFEER.B.IFEE0 = failing) //Failing-Edge Event Enable

//Para EXRQ[8]
#define EIRQ8_PCR  										(SIU.PCR[46].R = 0x0101) //PC14 Input Buffers : Enabled,	Weak Pull Up/Down Select : Up   
#define EIRQ8_enable									(SIU.IRER.B.EIRE8 = TRUE) //Habilita EIRQ[0] para interrupcion externa
#define EIRQ8_Rising_edge(rising)						(SIU.IREER.B.IREE8 = rising) //Rising-Edge Event Enable
#define EIRQ8_Failing_edge(failing)			 			(SIU.IFEER.B.IFEE8 = failing) //Failing-Edge Event Enable





/* ==================================================== */
/* 				Function prototipes						*/

extern void EXT_INT_EIRQ0init(T_UBYTE rising,T_UBYTE failing);
extern void EXT_INT_EIRQ0init(T_UBYTE rising1,T_UBYTE failing1);

#endif